package Filter.Filter03;

import jakarta.servlet.*;
import jakarta.servlet.annotation.*;
import java.io.IOException;
import java.io.PrintWriter;

@WebFilter(filterName = "MyFilter01",urlPatterns = "/MyServlet02")
public class MyFilter01 implements Filter {
    public void init(FilterConfig config) throws ServletException {
    }

    public void destroy() {
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
        PrintWriter out = response.getWriter();
        out.println("<h1 style='color: aqua'>MyFilter01 Before</h1>");
        chain.doFilter(request,response);
        out.println("<h1 style='color: aqua'>MyFilter01 After</h1>");
    }
}
